package com.qhw.servlet;

import com.qhw.JdbcUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/qhwadd")
public class UserAddServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //取值
        String name = req.getParameter("name");
        String username = req.getParameter("username");
        //储值
        String s = "insert into  `user`(username,`password`,`name`)values(?,MD5(666),?)";
        int modify = JdbcUtils.modify(s, username, name);
        //跳转
        resp.sendRedirect("qhw/user-list.jsp");

    }
}
